package unit4.part5;

import java.util.Arrays;

public class ConstructionMethodTest {

    private int id;

    private String name;

    private int[] array;

    public ConstructionMethodTest() {
        System.out.println("无参构造函数");
    }

    public ConstructionMethodTest(int id, String name, int[] array) {
        this.id = id;
        this.name = name;
        this.array = array;
        System.out.println("多参构造函数");
    }

    @Override
    public String toString() {
        return "ConstructionMethodTest{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", array=" + Arrays.toString(array) +
                '}';
    }

    public static void main(String[] args) {
        ConstructionMethodTest cmt1 = new ConstructionMethodTest();
        ConstructionMethodTest cmt2 = new ConstructionMethodTest(1, "ZhangSan", new int[]{1, 2, 3});
        System.out.println(cmt1);
        System.out.println(cmt2);
    }
}
